﻿Namespace DoFactory.GangOfFour.Facade.Structural

    ''' <summary>
    ''' MainApp startup class for Structural
    ''' Facade Design Pattern.
    ''' </summary>
    Public Class MainApp
        ''' <summary>
        ''' Entry point into console application.
        ''' </summary>
        Public Shared Sub Main()
            Dim facade As New Facade()

            facade.MethodA()
            facade.MethodB()

        End Sub

    End Class

    ''' <summary>
    ''' The 'Subsystem ClassA' class
    ''' </summary>
    Class SubSystemOne

        Public Sub MethodOne()
            Console.WriteLine(" SubSystemOne Method")
        End Sub

    End Class

    ''' <summary>
    ''' The 'Subsystem ClassB' class
    ''' </summary>
    Class SubSystemTwo

        Public Sub MethodTwo()
            Console.WriteLine(" SubSystemTwo Method")
        End Sub

    End Class

    ''' <summary>
    ''' The 'Subsystem ClassC' class
    ''' </summary>
    Class SubSystemThree

        Public Sub MethodThree()
            Console.WriteLine(" SubSystemThree Method")
        End Sub
    End Class

    ''' <summary>
    ''' The 'Subsystem ClassD' class
    ''' </summary>
    Class SubSystemFour

        Public Sub MethodFour()
            Console.WriteLine(" SubSystemFour Method")
        End Sub
    End Class

    ''' <summary>
    ''' The 'Facade' class
    ''' </summary>
    Class Facade

        Private _one As SubSystemOne

        Private _two As SubSystemTwo

        Private _three As SubSystemThree

        Private _four As SubSystemFour

        Public Sub New()
            _one = New SubSystemOne()
            _two = New SubSystemTwo()
            _three = New SubSystemThree()
            _four = New SubSystemFour()
        End Sub

        Public Sub MethodA()
            Console.WriteLine(vbLf & "MethodA() ---- ")
            _one.MethodOne()
            _two.MethodTwo()
            _four.MethodFour()
        End Sub

        Public Sub MethodB()
            Console.WriteLine(vbLf & "MethodB() ---- ")
            _two.MethodTwo()
            _three.MethodThree()
        End Sub

    End Class

End Namespace
